package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.vo.QuestionVo;
import org.apache.ibatis.annotations.*;

/**
 * @author 钱柏羽
 * @date 2021/07/18
 */
public interface QuestionVoMapper {

    @Select("SELECT id qid,sid,question FROM tb_survey_question WHERE id=#{qid}")
    QuestionVo findByQid(@Param("qid") Integer qid);

    @Delete("DELETE FROM tb_survey_question WHERE id=#{qid}")
    void deleteQuestionByQid(@Param("qid") Integer qid);

    @Update("UPDATE tb_survey_question SET question=#{question} WHERE id=#{qid}")
    void updateQuestionById(@Param("qid") Integer qid,@Param("question") String question);

    @Insert("INSERT tb_survey_question VALUES(NULL,#{question},#{sid})")
    void saveQuestion(@Param("question") String question,@Param("sid") Integer sid);
    @Select("SELECT MAX(id) FROM tb_survey_question")
    Integer getNewQuestionId();
}
